import React,{useEffect,useState} from "react";
import { Swiper ,Image } from "react-vant";

import axios from "../../untils/axios"
type Props = {};

const My = (props: Props) => {
  const [data,setData]=useState([])
  useEffect(()=>{
  axios.get("/api/list").then(res=>{
    setData(res.data.list)
  })
  },[])
  return (
    <div>
      <div className="demo-swiper">
      <Swiper>
        {data.map((item:any,index:number) => (
          <Swiper.Item key={index}>
            <Image lazyload src={item.img} />
          </Swiper.Item>
        ))}
      </Swiper>
      </div>
    </div>
  );
};

export default My;
